/**
 * Created by zxr on 16/11/10.
 */
function task1(){
	console.log('task1')
	next()
}

function task4(){
	console.log('task4')
}
function task2(){
	console.log('task2')
	next()
}
function task3(){
	console.log('task3')
	next()
}
var task = [task1,task2,task3,task4];

function next(err){
	if (err) throw err
	var currentTask = task.shift();
	if (currentTask){
		currentTask();
	}
}
next();